﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hyt.Web.Security;
using Hyt.Passport;
using Hyt.Passport.Service;
using Hyt.Web;
using Hyt.Passport.QueryModels;
using Hyt.Core.Data;
using Hyt.Passport.Models;

namespace Huayuan.ApplicationService
{
    public partial class ServiceCenter
    {

        public virtual List<Position> GetAllPosition()
        {
            var positionService = UnitOfWork.Get<PositionService>();
            return positionService.GetAll().ToList();
        }

        public virtual Position GetPositionById(Guid id)
        {

            var positionService = UnitOfWork.Get<PositionService>();
            return positionService.Get(id);
        }

        public virtual PagedList<Position> GetPositions(PositionQueryModel qo)
        {
            var positionService = UnitOfWork.Get<PositionService>();
            return positionService.GetPositions(qo).ToList();
           
        }


        public virtual void CreatePosition(Position position)
        {
            var positionService = UnitOfWork.Get<PositionService>();
            positionService.Create(position);
        }


        public virtual void DeletePosition(Guid id)
        {
            var positionService = UnitOfWork.Get<PositionService>();
            positionService.Remove(id);
        }
        public virtual void DeletePositions(Guid[] id)
        {
            var positionService = UnitOfWork.Get<PositionService>();
            foreach (var pid in id)
            {
                positionService.Remove(pid);
            }
        }
    }
}
